package com.homegoods.orderinfodetail.presenter;

import android.databinding.ObservableBoolean;
import android.databinding.ObservableField;
import android.text.Editable;
import android.text.TextUtils;

import com.kedll.library.mvp.BasePresenter;
import com.kedll.library.mvp.BaseView;

/**
 * @author QiQi
 * @description 发票Presenter层
 */
public class InvoicePresenter extends BasePresenter<BaseView> {

    /**
     * 发票类型 True 个人 false 公司
     */
    public final ObservableBoolean invoiceType = new ObservableBoolean(true);

    /**
     * 收票人信息1 当是个人时：收票人手机号；当是公司时: 公司发票抬头
     */
    public final ObservableField<String> info1 = new ObservableField<>();

    /**
     * 收票人信息2 当是个人时：收票人邮箱； 当是公司时：纳税人识别号
     */
    public final ObservableField<String> info2 = new ObservableField<>();

    public final ObservableBoolean canSubmit = new ObservableBoolean();

    public InvoicePresenter(BaseView view) {
        super(view);
    }

    public void afterTextChanged(Editable s){
        canSubmit.set(!TextUtils.isEmpty(info1.get()) && !TextUtils.isEmpty(info2.get()));
    }
}